package com.krio.spaceship;

import org.cocos2d.layers.*;
import org.cocos2d.nodes.CCDirector;
import org.cocos2d.nodes.CCLabel;
import org.cocos2d.nodes.CCTextureCache;
import org.cocos2d.particlesystem.CCParticleFire;
import org.cocos2d.particlesystem.CCParticleSnow;
import org.cocos2d.particlesystem.CCParticleSystem;
import org.cocos2d.types.CGPoint;
import org.cocos2d.types.CGSize;

import BackgroundLayer.BackgroundLayer;
import android.view.MotionEvent;



public class GameLayer extends CCLayer {
	public Ship ship;
	public BackgroundLayer backgroundLayer;
	
	public GameLayer(){
		super();
		this.startNewGame();
	}
	
	public void startNewGame(){
		this.backgroundLayer = new BackgroundLayer();
		this.backgroundLayer.setAnchorPoint(0, 0);
		this.backgroundLayer.setPosition(0, 0);
		
		this.ship = new Ship();
		this.ship.setAnchorPoint(0, 0);
		this.ship.setPosition(65, 55);
		this.ship.yAcceleration = 0;
		
		this.addChild(this.backgroundLayer);
		
		this.addChild(ship, 2, 0);
		this.scheduleUpdate();
	}
	
	public CCScene scene() {
		CCScene scene = CCScene.node();
		//GameLayer layer = new GameLayer();
		
		scene.addChild(this);
		
		return scene;
	} 
	
	
	public void update(float dt){
		this.updateShip(dt);
	}
	
	private void updateShip(float dt){
		ship.update(dt);
	}
}
